<script setup >
import { onShow } from '@dcloudio/uni-app'
import { useReceiveOrder } from './hooks/useReceiveOrder'
import OrderItem from "@/global/components/orderItem/OrderItem.vue";
const { receiveData, getReceiveData,loading } = useReceiveOrder()
onShow(() => {
  uni.setNavigationBarColor({
    backgroundColor: '#e64340'
  });
  getReceiveData()
})
const handleToOrderDetail = ({ id }) => uni.navigateTo({ url: '/pages/order/orderDetail?id=' + id })
</script>
<template>
  <view class="receive-order-container">
    <up-loading-icon v-if="loading"  text="加载中"/>
      <view v-else>
          <up-empty v-if="!receiveData.length" text="空空如也~" />
        <blockquote v-else>
          <order-item
              :refresh-data="getReceiveData"
              @click="() => handleToOrderDetail(order)"
              v-for="order in receiveData"
              :order="order"
              show-order-time
          />
        </blockquote>
      </view>
  </view>
</template>

<style scoped lang="scss">
uni-page-body {
  background-color: $u-primary-light;
  width: 100%;
  height: 100%;
}
:deep(.uni-page-head-btn) {
  display: block !important;
}
.receive-order-container {
  padding: 30rpx;
  .order-item-container {
    margin-top: unset !important;
    margin-bottom: 25rpx;
  }
}
</style>
